Skip to content

Fix panic on raw string assist #2099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2019
Merged

Conversation

aee11
Copy link
Contributor

@aee11 aee11 commented Oct 27, 2019

Strings that do not contain two quotation marks would cause a slice indexing panic because find_usual_string_range would return a range that only contained a single quotation mark.
Panic example:

fn main() {
    let s = "<|>
}

I noticed a lot of panics from the make_raw_string assist while working on another issue today.

Strings that do not contain two quotation marks
would cause a slice indexing panic because code
was assuming `find_usual_string_range` would return
a string with two quotes, but it would incorrectly
also return text ranges containing only a single quote.
@matklad
Copy link
Member

matklad commented Oct 27, 2019

Thanks!

bors r+

bors bot added a commit that referenced this pull request Oct 27, 2019
2099: Fix panic on raw string assist r=matklad a=aee11

Strings that do not contain two quotation marks would cause a slice indexing panic because `find_usual_string_range` would return a range that only contained a single quotation mark.
Panic example:
```
fn main() {
    let s = "<|>
}
```

I noticed a lot of panics from the `make_raw_string` assist while working on another issue today.

Co-authored-by: Alexander Elís Ebenesersson <[email protected]>
@bors
Copy link
Contributor

bors bot commented Oct 27, 2019

Build succeeded

@bors bors bot merged commit 17bd3e5 into rust-lang:master Oct 27, 2019
@aee11 aee11 deleted the partial-string-crash branch October 28, 2019 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants